def countConsistentStrings(allowed, words):
    """
    统计一致字符的个数
    给你一个由不同字符组成的字符串allowed和一个字符串数组words。如果一个字符串的每一个字符都在 allowed中，就称这个字符串是 一致字符串 。
    请你编写函数countConsistentStrings(allowed, words)，返回words数组中一致字符串 的数目。
    测试用例：
    allowed = "ab", words = ["ad","bd","aaab","baa","badab"] => 2
    allowed = "abc", words = ["a","b","c","ab","ac","bc","abc"] => 7
    allowed = "cad", words = ["cc","acd","b","ba","bac","bad","ac","d"] => 4
    :param allowed:
    :param words:
    :return:
    """
    count = 0
    index = 0

    while index < len(words):
        isOk = True

        for char in words[index]:
            if char not in allowed:
                isOk = False
                break

        count += 1 if isOk else 0

        index += 1

    return count


if __name__ == '__main__':
    print(countConsistentStrings("ab", ["ad", "bd", "aaab", "baa", "badab"]))
    print(countConsistentStrings("abc", ["a", "b", "c", "ab", "ac", "bc", "abc"]))
    print(countConsistentStrings("cad", ["cc", "acd", "b", "ba", "bac", "bad", "ac", "d"]))
